import axios from 'axios'
import { showDialog } from 'vant'

const request = axios.create({
    // baseURL: 'http://192.168.57.160:3000/api'
    baseURL:"http://121.89.205.189:3000/api"
})

export const request2 = axios.create({
    baseURL:"http://localhost:3000/"
})

// 响应拦截
request.interceptors.response.use(res=>{
    if(res.data.code =='200'){
        return  res.data
    }else{
        showDialog({
            message:res.data.message
        })
        return false
    }
})
// 请求拦截
request.interceptors.request.use(req=>{
    req.headers.token = localStorage.getItem('token')
    return req
})
export default request

